<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<h:head>
	<title>Aggiungi Alloggio</title>
	</h:head>
<h:body>	   
	<h:form id="form"> 
			    <p:messages id="messages" showDetail="true" autoUpdate="true" closable="false" />  
	
		<h4>Nome</h4>
	<p:inputText id="nome" value="#{tipicomponente.aDTO.nome}" required="true" requiredMessage="Inserisci il Nome!">
	 </p:inputText>
	 <p:message for="nome" />  
	
		<h4>Prezzo</h4>
		 <h:outputLabel for="prezzo" />  
            <p:spinner id="prezzo"   
                    value="#{tipicomponente.integerAll}" min="1" max="999999" required="true" requiredMessage="Inserisci il Prezzo!"/>  
            <p:message for="prezzo" /> 
    
        <h4>Città</h4>
	<p:inputText id="citta" value="#{tipicomponente.aDTO.citta}" required="true" requiredMessage="Inserisci la Città!">
	 </p:inputText>
	 <p:message for="citta" />  
	  
 		<h4>CheckIn</h4>  
    <p:calendar id="checkin" value="#{tipicomponente.aDTO.checkIn}" pattern="dd/MM/yyyy" mindate="#{tipicomponente.oggi()}" timeZone="Europe/Rome"  required="true" requiredMessage="Inserisci il CheckIn!">
                </p:calendar>   
                <p:message for="checkin"/>	

	   <h4>CheckOut</h4>
	   <p:calendar id="checkout" value="#{tipicomponente.aDTO.checkOut}" pattern="dd/MM/yyyy" mindate="#{tipicomponente.oggi()}" timeZone="Europe/Rome" required="true" requiredMessage="Inserisci il CheckOut!">
                </p:calendar>
                <p:message for="checkout"/>	   
	
   	<p:commandButton value="Submit" action="#{tipicomponente.saveAlloggio()}" actionListener="#{tipicomponente.checkDataAlloggio}" ajax="false" icon="ui-icon-check" validateClient="true"/>  
	
	
	 <p:dialog header="Selected Dates" widgetVar="dialog" showEffect="fold" hideEffect="fold">  
  
        <h:panelGrid id="display" columns="2" cellpadding="5">  
  
            	<h:outputText value="CheckIn: " />  
            <h:outputText value="#{tipicomponente.aDTO.checkIn}">  
                <f:convertDateTime pattern="dd/MM/yyyy" />  
            </h:outputText>  
            
            <h:outputText value="CheckOut: " />  
            <h:outputText value="#{tipicomponente.aDTO.checkOut}" >  
                <f:convertDateTime pattern="dd/MM/yyyy" />  
            </h:outputText>  
       
         </h:panelGrid>    
    </p:dialog>  
       
    <p:dialog header="Values" widgetVar="dlg" showEffect="fold" hideEffect="fold">  
        <h:panelGrid id="disp" columns="2" cellpadding="5">  
   
              
            <h:outputText value="Prezzo: " />  
            <h:outputText value="#{tipicomponente.integerAll}" />   
    
        </h:panelGrid>  
     </p:dialog>  
</h:form>
</h:body>
</html>